// 处理模版的公用方法



export default class ProcessTmp {
    constructor(child, context) {
        this.comp = context;
    }

     // 给批量新增弹窗的查询弹窗添加查询条件
     addQueryConditionToMultiAddSearch = (template, searchId, optype = 1) => {
        const {props} = this.comp;
        const {emp} = props;

        template[searchId].items.map((item) => {
            if(item.attrcode === 'hi_psnjob.clerkcode') {
                item.queryCondition = {
                    pk_org: emp.orgValue.refpk,
                    GridRefActionExt: 'nccloud.web.hryf.pub.sqlbuilder.BatchAddClerkcodeRefSqlBuilder',
                    optype: optype
                };
            }
        });
    }

    // 给所有form模版的item添加queryCondition空对象
    addEmptyObjectToFormTemplate = (template) => {
        Object.keys(template).forEach((key) => {
            if(template[key].moduletype === 'form') {
                template[key].items.forEach((item) => {
                    if(!item.queryCondition) {
                        item.queryCondition = {};
                    }
                });
            }
        });

        return template;
    }
}